package com.songtai.dao.impl;

import java.util.List;

import com.songtai.dao.PublicObjDao;
import com.songtai.po.PublicObj;

/**
 * 通过文字
 * 
 * @author lx
 * 
 */
public class PublicObjDaoImpl extends GenericDaoImplHibernate<PublicObj>
		implements PublicObjDao {

	/**
	 * 根据前台的目录读出相应的文字信息
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<PublicObj> getObjsByNid(String nid) {
		return this.getHibernateTemplate().find(
				"from PublicObj as p where nid = ?", new Long(nid));
	}

	@SuppressWarnings("unchecked")
	public PublicObj getPublicObj(String nid) {
		List<PublicObj> list= (List<PublicObj>) this.getHibernateTemplate().find(
				"from PublicObj as p where p.nid = '"+nid+"'");
		if(list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
